<?php $mainbar = 'main';
 $pageId="page-order-form";
?>
@extends('ios.pageIndex')

@section('page-content')
<div class="content-padded">
	 <form method="post" action="{{URL::to('order')}}" id="order-form"  name="order-form" class="ajax-submit">
	 <div class="content-block-title"><b>送货地址</b></div>
	 <div class="list-block media-list no-padded no-border font-normal">
	  <ul id="address-list">
	    <!-- Single chekbox item -->
	    @if (!empty($addresses))
		@foreach($addresses as $adrs)
	    <li id="address-checkbox-{{$adrs->id}}" class="address-checkbox" data-id='{{$adrs->id}}' data-mobile='{{$adrs->mobile}}' data-name='{{$adrs->name}}' 
			data-zipcode='{{$adrs->zipcode}}' data-street='{{$adrs->street}}'
			data-province_id='{{$adrs->province_id}}' data-city_id='{{$adrs->city_id}}' data-district_id='{{$adrs->district_id}}'>
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <input type="radio" name="user_address_id" value="{{$adrs->id}}">
	        <div class="item-media top">
	          <i class="icon icon-form-checkbox"></i>
	        </div>
	        <div class="item-inner">
	          <div class="item-subtitle name">{{$adrs->name}}</div>
	          <div class="item-subtitle address">{{$adrs->province}} {{$adrs->city.$adrs->district.$adrs->street}}</div>
	          <div class="item-subtitle mobile">{{$adrs->mobile}}</div>
	        </div>
	      </label>
	    </li>
	    @endforeach
		@endif
	  </ul>
	  <div class="row">
         <div class="col-50 hidden" id="update-address-button">
          	<a class="button update-address">修改地址</a>
        </div>
        <div class="col-50">
          	<a class="button add-address">新地址</a>
        </div>
      </div>
	</div>
	
	<div class="content-block-title">礼物卡片选项</div>
	<div class="list-block no-padded no-border font-normal m-card-list-block" style="margin-bottom: 12px;">
	  <ul>
	    <li class="card-checkbox no">
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <input type="radio" name="card_type" value="1" checked="checked">
	        <div class="item-media">
	          <i class="icon icon-form-checkbox"></i>
	        </div>
	        <div class="item-inner">
	          <div class="item-title">我不需要卡片</div>
	        </div>
	      </label>
	    </li>
	    <li class="card-checkbox no">
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <input type="radio" name="card_type" value="2">
	        <div class="item-media">
	          <i class="icon icon-form-checkbox"></i>
	        </div>
	        <div class="item-inner">
	          <div class="item-title">我需要一张空白卡片</div>
	        </div>
	      </label>
	    </li>
	    <li class="card-checkbox yes">
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <input type="radio" name="card_type" value="3">
	        <div class="item-media">
	          <i class="icon icon-form-checkbox"></i>
	        </div>
	        <div class="item-inner">
	          <div class="item-title">请为我代写一张卡片</div>
	        </div>
	      </label>
	    </li>
	  </ul>
	  
	</div>
	
	<div id="card-content-wrap" class="hidden">
		<div class="m-form-control ">
         <textarea id="card_content" name='card_content' placeholder="我们可为您代写卡片, 请在此输入卡片内容，字数限制为100字"></textarea>
	     </div>
	     <div class="border-bottom" style="margin-top: 24px;"></div>
	</div>
	
      
	<div class="content-block-title" style="margin-top: 24px;">如有特殊要求请在此留言</div>
	<div class="m-form-control">
		<textarea id="leave_message" name='leave_message' placeholder="字数限制为100字"></textarea>
	</div>
	<div class="m-cart-list">
		<div class="text-center">
	        <span style="width:42px; height:42px" class="preloader"></span>
	      </div>
	</div>
	{{Form::token()}}
	<button type="submit" class="button button-big m-button">确认</button>
	</form>
</div>
@stop

@section("more-pages")
<div data-page="page-add-address" class="page navbar-fixed cached">
  <div class="navbar">
	<div class="navbar-inner">
		<div class="left sliding">
			<!-- Right link contains only icon - additional "icon-only" class-->
		<a  href="#" class="link back"> <i class="icon icon-left"></i> 返回</a>
	</div>
	<div class="center sliding">
		添加/修改地址
	</div>
	</div>
 </div>
 <!-- Scrollable page content-->
 <div class="page-content">
    <div class="content-padded">
       <form class="ajax-submit"  id="add-address-form" name="add-address-form" method="post" action="{{URL::to('user/address/add')}}">
			 <div class="m-form-control">
			 	<label>姓名<span class="text-red">*</span></label>
			 	<input type="text" class="validate" id="name" name="name" 
							data-rules="required|max_length[32]" data-display="姓名" placeholder="输入姓名">
			 </div>
			 
			 <div class="m-form-control">
			 	<label>手机<span class="text-red">*</span></label>
			 	<input type="text" class="validate" id="mobile" name="mobile" 
			data-rules="required|mobile" data-display="手机号" placeholder="输入手机号">
			 </div>
			 
			 <div class="m-form-control">
			 	<label>邮政编码</label>
			 	<input type="text" class="validate" id="zipcode" name="zipcode" 
			data-rules="max_length[16]|alpha_numeric" data-display="邮政编码" placeholder="输入邮政编码">
			 </div>
			 <div class="m-form-control">
			 	<label>省/直辖市<span class="text-red">*</span></label>
			 	 <select id="province_id" name="province_id" class="validate cs-select cs-skin-elastic"></select>
			 </div>
			 <div class="m-form-control">
			 	<label>市<span class="text-red">*</span></span></label>
			    <select id="city_id" name="city_id" class="validate cs-select cs-skin-elastic">
			    </select>
			 </div>
			 <div class="m-form-control">
			 	<label>区/县<span class="text-red">*</label>
			    <select id="district_id" name="district_id" class="validate cs-select cs-skin-elastic">
			  </select>
			 </div>
			 
			 <div class="m-form-control">
			 	<label>详细地址<span class="text-red">*</span></label>
		 		<textarea  class="validate" id="street" name="street"
					data-rules="required|max_length[256]" data-display="详细地址" placeholder="请输入详细地址"></textarea>
			 </div>
	    	{{Form::token()}}
	    	<button type="submit" class="button button-big m-button">保存</button>
	  </form>
    </div>
 </div>
</div>
@stop

@section('script')
<script type="text/template7" id="cartTemplate">
<div class="list-block media-list no-padded font-normal" style="margin-top:24px;">
  <ul>
    @{{#each products}}
    <li id="product@{{id}}-@{{size_id}}-@{{color_id}}" data-id="@{{id}}" data-size_id="@{{size_id}}" data-color_id="@{{color_id}}" data-quantity="@{{quantity}}" data-price="@{{price}}">
      <a class="item-content border-bottom external" href="@{{url "product/" id}}">
        <div class="item-media"><img src="@{{imgurl image w="72" h="84"}}"></div>
        <div class="item-inner">
          <div class="item-title-row top">
            <div class="item-title">@{{enname}}</div>
          </div>
		  <div class="item-subtitle">@{{name}} <em class="unenough"></em></div>
		  @{{#if size_id}}
              <div class="item-subtitle">尺寸：@{{size}}</div>
          @{{/if}}
          @{{#if color_id}}
              <div class="item-subtitle">颜色：@{{color}}</div>
          @{{/if}}
          <div class="item-title-row bottom">
            <div class="item-subtitle">  数量：@{{quantity}}</div>
            <div class="item-after product-fee">¥@{{mfnumber price quantity}}</div>
          </div>
        </div>
      </a>
    </li>
    @{{/each}}
  </ul>
</div>

<div class="text-right fee">
	<div>
		小计：¥<span id="products-fee">@{{fnumber fee.productsFee}}</span>元</br>
        运费：¥<span id="postage">@{{fnumber fee.postage}}</span>元</br>
总计：¥<span id="total-fee">@{{fnumber fee.totalFee}}</span>元</br>
   </div>
</div>
</script>
<script type="text/template7" id="addressTemplate">
<li class="address-checkbox-@{{id}}" data-id='@{{id}}' data-mobile='@{{mobile}}' data-name='@{{name}}' 
			data-zipcode='@{{zipcode}}' data-street='@{{street}}'
			data-province_id='@{{province_id}}' data-city_id='@{{city_id}}' data-district_id='@{{district_id}}'>
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <input type="radio" name="user_address_id" value="@{{id}}">
	        <div class="item-media top">
	          <i class="icon icon-form-checkbox"></i>
	        </div>
	        <div class="item-inner">
	          <div class="item-subtitle">@{{name}}</div>
	          <div class="item-subtitle">@{{province}} @{{city}}@{{district}}@{{street}}</div>
	          <div class="item-subtitle">@{{mobile}}</div>
	        </div>
	      </label>
	    </li>
</script>

@stop
